package com.conversationboard.model.useraccess;

import java.util.Date;

import com.conversationboard.formatter.DateFormatter;
import com.conversationboard.model.User;

public class UserAccessInfo implements Comparable<UserAccessInfo> {

	private String loginId;
	private String displayName;
	private Date lastAccessed;
	private User viewingUser;


	public int compareTo(UserAccessInfo userAccessInfo) {

		int result = userAccessInfo.lastAccessed.compareTo(this.lastAccessed);
		return result;
	}


	public String getLoginId() {
		return loginId;
	}


	public void setLoginId(String loginId) {
		this.loginId = loginId;
	}


	public User getViewingUser() {
		return viewingUser;
	}


	public void setViewingUser(User viewingUser) {
		this.viewingUser = viewingUser;
	}


	public String getDisplayName() {
		return displayName;
	}


	public void setDisplayName(String displayName) {
		this.displayName = displayName;
	}


	public Date getLastAccessed() {
		return lastAccessed;
	}


	public String getLastAccessedString() {

		if ((this.lastAccessed == null) || (this.viewingUser == null)) {
			return "";
		}

		String lastAccessedString = DateFormatter.prettyPrintTime(this.lastAccessed, this.viewingUser, true, true);

		return lastAccessedString;

	}


	public void setLastAccessed(Date lastAccessed) {
		this.lastAccessed = lastAccessed;
	}

}
